<?php 
$callback = $_GET["callback"];
$url = $_GET["url"];
 
if($callback)
{
	echo $callback . "({";
	if($url)
	{
		$ch=curl_init(); 
		$timeout=3; 
		curl_setopt($ch, CURLOPT_URL, $url); 
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
		curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout); 
		$lines_string=curl_exec($ch); 
		curl_close($ch);
		$encode = mb_detect_encoding($lines_string, array("GB2312","UTF-8"));
		
		if($encode == "UTF-8")
		{
			header("Content-type: application/x-javascript; charset=utf-8");		
		}
		else if($encode == "EUC-CN")
		{
			header("Content-type: application/x-javascript; charset=GB2312");		
		}	
		echo "\"data\":\"" . str_replace("\n","\\n",$lines_string) . "\"";					
	}
	echo "})";
}
?>